<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function repeat(nums, delay, fn) {
            let arr = []
            return function (param) {
                arr.push(param)
                if (arr.length === nums) {
                    setInterval(() => {
                        console.log('----');
                        fn(arr[0], arr[1])
                    }, delay)
                }
            }
        }
        let timeLog = repeat(2, 1000, console.log)
        timeLog("hello world")
        timeLog("ByteDance")
    </script>
</body>

</html>